<?php
/*
*
* Deprecated, usar partials en views/scripts/snnipet
*
*/
class My_View_Helper_Msg extends Zend_View_Helper_Abstract
{
       

        public function msg($msg,$tipomsg='head',$title=null,$translate=true)
        {
          
          $msg= $translate  ? $this->view->translate($msg) : $msg;
          
          $title=is_null($title) ? '':$title;
          $title= $translate  ? $this->view->translate($title) : $title;
          
          switch($tipomsg){
            case('head'): 
                return $this->Head($msg);
            case('flash'): 
                return $this->Flash($msg);
            case('atencion'): 
                return $this->Atencion($msg,$title);
            case('error'): 
                return $this->Error($msg);
            default:
                return $msg;
          }
          
        }
        
   
        
        public function Error($msg){
            
            $error='
            	<div class="atencion ui-state-error"> 
            	<p><span class="ui-icon ui-icon-alert" style="float: left;"></span> 
            	<strong>'.$this->view->translate('Error').'</strong>
                <div style="clear:both"></div>
                %s
            	</p>
            	</div>';
                
        
             return sprintf($error,$msg);
            
        }
    
        public function Atencion($msg,$title){
                if(is_null($title)) $title='Atención:';
            
               $ok='
            	<div class="atencion ui-state-highlight" > 
            	<p><span class="ui-icon ui-icon-info" style="float: left;"></span>
                <strong>'.$title.'</strong>
                <div style="clear:both"></div>
                    %s
            	</p>
            	</div>
            ';
            
    
            
            return sprintf($ok,$msg);
        }
        
        
        public function Flash($msg){
                $id='keyid'.time().rand(0,100);
                $ok='<div class="ui-widget" style="width:%s" id="'.$id.'">
            	<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
            	<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                <strong>'.$this->view->translate('Mensaje').':</strong><br />
                %s
            	</p>
            	</div>
            </div>';
            

            return sprintf($ok,'40%',$msg);
        }     

        public function Head($msg){
             $ok='<h1 class="h1_head ui-widget-header">%s</h1>';
            return sprintf($ok,$msg);
        }  
        
        
        
        
        
}